<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue.js + axios + api</title>
  <script src="https://cdn.staticfile.org/vue/2.7.0/vue.min.js"></script>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <!--    自加-->
        <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
        <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
        <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
        <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<!--<h1>显示列表</h1>-->
<div id="vue_user" class="container">
<!--    {{info}}-->
    <h2>显示列表</h2>
    <table class="table">
        <thead>
        <tr>
            <th>密码</th>
            <th>用户名</th>
            <th>id</th>
        </tr>
        </thead>
        <tbody v-for="u in info">
        <tr>
            <td>{{u.password}}</td>
            <td>{{u.username}}</td>
            <td>{{u.id}}</td>
        </tr>
        </tbody>
    </table>
    </div>

<!--    {{info}}-->
<!--    <p v-for="u in info">{{u.username}}+{{u.password}}</p>-->
</div>


<script type="text/javascript">
    var vm = new Vue({
        el: '#vue_user',
        data: {
        },
        methods: {
        },
        data () {
            return {
              info: null
            }
        },
        mounted () {
              axios
                .get('/hi')
                .then(response => (this.info = response.data))
                .catch(function (error) { // 请求失败处理
                  console.log(error);
                  });
              }
        })

</script>
</body>
</html>